//
//  YWKBanner+Config.m
//  YWKUser
//
//  Created by  WangDan on 16/4/26.
//  Copyright © 2016年 iCareTech. All rights reserved.
//

#import "TCBanner+Config.h"
#import "TCConfiguration.h"

NSString * const kNewReportStatus = @"reportStatus";
NSString * const kNewReportType = @"type";
NSString * const kNewReportTips = @"integratedTips";
NSString * const kNewReportOxygenTension = @"arterialOxygenTension";
NSString * const kNewReportSpo2Less = @"spo2LessThanNormalTime";
NSString * const kNewReportOxygenTeductionTime = @"oxygenTeductionTime";
NSString * const kNewReportHowLong = @"howLong";

@implementation TCBanner (Config)

- (void)configBannerAtView:(UIView *)view withArray:(NSArray *)array isAutoScroll:(BOOL)isAutoScroll{
    
    if (!array || array.count == 0) {
        return;
    }
    
    NSMutableArray *idArray = @[].mutableCopy;
    NSMutableArray *contentArray = @[].mutableCopy;
    NSMutableArray *imgUrlArray = @[].mutableCopy;
    NSMutableArray *nameArray = @[].mutableCopy;
    
    for (NSDictionary *aBanner in array) {
//        [idArray addObject:aBanner[kYWKBannerInfoID]];
//        [contentArray addObject:aBanner[kYWKBannerInfoContent]];
//        [imgUrlArray addObject:aBanner[kYWKBannerInfoImgURL]];
//        [nameArray addObject:aBanner[kYWKBannerInfoName]];
    }
    
    self.detailURLs = contentArray.copy;
    self.bannerImgUrls = imgUrlArray;
    
    [self addBanner:view withImgUrls:imgUrlArray isAutoScroll:isAutoScroll];
}

- (void)updateBannerAtView:(UIView *)view WithInfo:(NSDictionary *)reportInfo isAutoScroll:(BOOL)isAutoScroll{

    if (!reportInfo || reportInfo.allKeys.count == 0) {
        
        self.hasMonitorResult = NO;
    }

    if ([reportInfo[kNewReportStatus] integerValue] < 0) {
        
        self.hasMonitorResult = NO;
    }

    NSInteger reportType = [reportInfo[kNewReportType] doubleValue];
    NSInteger diseaseRiskLevel = [reportInfo[kNewReportTips] integerValue];
    
    if (reportType <= 0) {

       
    }
    
    [self addBanner:view withImgUrls:self.bannerImgUrls isAutoScroll:isAutoScroll];

    
    /**
     *  
     1.reportStatus，大于0为正常，显示banner
     2.type，大于0为正常；3是慢阻肺，显示3条；其他4条
     3.integratedTips，风险等级指示
     4.arterialOxygenTension，氧减指数
     5.spo2LessThanNormalTime，缺氧累计时间
     6.OxygenTeductionTime，氧减事件时间
     7.howLong，监测总时间
     */
}

@end
